<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>FCRE2.1--考试中...</title>

    <link th:href="@{/assets/img/fcre.png}" rel="shortcut icon"/>
    <link th:href="@{/assets/css/bootstrap-combined.min.css}" rel="stylesheet"/>
    <link th:href="@{/assets/css/font-awesome.min.css}" rel="stylesheet"/>
    <link th:href="@{/assets/plugins/iCheck/custom.css}" rel="stylesheet"/>
    <link th:href="@{/assets/css/examstyle.css}" rel="stylesheet"/>

</head>
<body onbeforeunload="tm_checkUnsubmit()" onselectstart = "return false" oncopy="return false"  oncontextmenu="return false" >
<div class="container-fluid">
	<div class="row-fluid">
		<div class="span12"  id="bver" style="background-color: #FFEB3B;text-align: center;line-height: 80px;font-size:18px;color:#f00;">  
您正在使用<b>【IE浏览器】</b>或者其它浏览器的<b>【兼容模式】</b><img th:src="@{/assets/img/ie.png}">，不能正常使用本系统的功能，建议切换到【极速模式】<img th:src="@{/assets/img/jisu.png}">或更换浏览器。<br>推荐使用<a href='http://chrome.360.cn/'>360极速浏览器</a><img th:src="@{/assets/img/360jisu.png}">的【极速模式】。
		</div>
	</div>
	<div id="mynav" class="row-fluid">
		<div class="span12">
			<div class="navbar navbar-fixed-top">
				<div class="navbar-inner">
					<div class="container-fluid">
						 <a data-target=".navbar-responsive-collapse" data-toggle="collapse" class="btn btn-navbar">
						 <span class="icon-bar"></span><span class="icon-bar"></span>
						 <span class="icon-bar"></span>
						 </a> <a href="#" class="brand"></a>
						<div class="nav-collapse collapse navbar-responsive-collapse">
							<ul id="leftnav" class="nav">
								<li class="active">
									<h3 style="line-height: 20px;">[[${paper.name}]]</h3>
								</li>
								<li class="divider-vertical"></li>
								<li class="maybehide">
									<a href="#">考试时长：[[${paper.duration}]] 分钟</a>
								</li>
								<li class="maybehide">
									<a href="#">卷面总分：[[${paper.totalscore}]]</a>
								</li>
								<li>
									<a href="#" style="color:#00f;font-size:18px;">考生：[[${user.id}]]&nbsp;[[${user.userName}]]</a>
								</li>
							</ul>
							<ul id="rightnav" class="nav pull-right">
								<li>
									<th:block th:include="common :: countdown" ></th:block>
                        			<span id="div_processor_timer" style="margin-top:5px;float:left;"></span>
								</li>
								<li class="divider-vertical"></li>
								<li>
									<button type="button" id="endks" class="btn btn-primary" style="font-size: 16px;font-weight:bold;"><i class="fa fa-send fa-2x"></i>交卷</button>
								</li>
							
							</ul>
						</div>
						
					</div>
				</div>
				
			</div>
		</div>
	</div>
	<div id="mydata" class="row-fluid">
		<div class="span8">
            <div class="tm_main">
            <div class="tm_container">
			<table border="0" width="100%" cellpadding="0" style="min-width:860px;">
				<tr>
					<td valign="top">
						<form method="post" id="form_paper_detail">
						<input id="id" name="id" th:value="${id}" type="hidden">
						<input id="ksid" name="ksid" th:value="${paper.ksid}" type="hidden">
						<input id="uid" name="uid" th:value="${paper.uid}" type="hidden">
                    	<div class="tm_paper">
                            
                         
                         	<div class="tm_paper_body" th:each="qtidmap: ${paper.qtidmap}">
                         		<div class="tm_paper_section"><!-- 一种题型 -->
                         			
                                	<h1 th:text="${qtidmap.value.qname}"></h1>
                                	<!-- 每一道题 -->
                                	<th:block th:each="question: ${qtidmap.value.qlist}" >
                                		<span class="span-quick-nav" th:id="'quick-Q-'+${question.id}"></span>
                                		<table border="0" cellpadding="0" cellspacing="0" class="tm_paper_question" style="table-layout:fixed;">
                                    	<thead>
                                        	<tr style="background-color: #efebeb;">
                                            	<th valign="top" class="tm_question_lineheight"><cite th:text="${#ids.seq('')}"></cite></th>
                                                <td class="tm_question_lineheight" th:utext="${question.name}"></td>
                                                <td class="tom_exam_score"  th:id="'scQ-'+${question.id}" th:text="${question.qscore}"></td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        	<tr>
                                            	<td colspan="3">
                                            	<ul th:if="${question.qtid}==1">
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="radio" value="A" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'A.&nbsp;'+ ${question.ansA}">
                                            			</label>
                                            		</li>
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="radio" value="B" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'B.&nbsp;'+ ${question.ansB}">
                                            			</label>
                                            		</li>
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="radio" value="C" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'C.&nbsp;'+ ${question.ansC}">
                                            			</label>
                                            		</li>
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="radio" value="D" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'D.&nbsp;'+ ${question.ansD}">
                                            			</label>
                                            		</li>
                                            	</ul>
                                            	<ul th:if="${question.qtid}==2">
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="checkbox" value="A" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'A.&nbsp;'+ ${question.ansA}">
                                            			</label>
                                            		</li>
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="checkbox" value="B" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'B.&nbsp;'+ ${question.ansB}">
                                            			</label>
                                            		</li>
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="checkbox" value="C" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'C.&nbsp;'+ ${question.ansC}">
                                            			</label>
                                            		</li>
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="checkbox" value="D" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'D.&nbsp;'+ ${question.ansD}">
                                            			</label>
                                            		</li>
                                            	</ul>
                                            	<ul th:if="${question.qtid}==4">
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="radio" value="A" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'A.&nbsp;'+ ${question.ansA}">
                                            			</label>
                                            		</li>
                                            		<li>
                                            			<label style='margin-left: 2px;'>
                                            			<input type="radio" value="B" class="form-control qk-choice" th:name="'Q-'+${question.id}" th:utext="'B.&nbsp;'+ ${question.ansB}">
                                            			</label>
                                            		</li>
                                            	</ul>
                                            	</td>
                                            </tr>
                                        </tbody>
                                    	</table>
                                	</th:block>
                                	
                                </div>
                         	</div>
                         </div>
                         </form>
                     </td>
                 </tr>
               </table>
            </div>                            
            </div>		
		</div>
		<div class="span4">
            <div id="div_processor">
				<div id="div_processor_fastto">
					<dl>
						<dt>设置题目文字大小</dt>
						<dd>
							<a href="javascript:void(0);" onclick="tmPaperFont(1)" id="tm_font_1" class="tm_font tm_font_min tm_font_on">A</a>
							<a href="javascript:void(0);" onclick="tmPaperFont(2)" id="tm_font_2" class="tm_font tm_font_mid">A</a>
							<a href="javascript:void(0);" onclick="tmPaperFont(3)" id="tm_font_3" class="tm_font tm_font_max">A</a>
						</dd>
					</dl>
					<dl th:each="qtidmap: ${paper.qtidmap}">
						<dt th:text="${qtidmap.value.qname}+'（'+${qtidmap.value.qscore}+'分）'"></dt>
						<dd>
							<th:block th:each="question: ${qtidmap.value.qlist}" >
								<a href="javascript:void(0);" th:onclick="'moveToQuestion(\''+${question.id}+'\')'" th:id="'fast_'+${question.id}" th:text="${#ids.seq(' ')}" ></a>
								
							</th:block>
							<div class="tm_clear"></div>
						</dd>
					</dl>
				</div>
			</div>		
		</div>
	</div>
</div>

<!-- 全局js -->
<script th:src="@{/assets/js/jquery.min.js}"></script>
<script th:src="@{/assets/js/bootstrap.min.js}"></script>
<script th:src="@{/assets/plugins/blockUI/jquery.blockUI.js}"></script>
<script th:src="@{/assets/plugins/fullscreen/jquery.fullscreen.js}"></script>
<script th:src="@{/assets/plugins/iCheck/icheck.min.js}"></script>
<script th:src="@{/assets/plugins/layer/layer.min.js}"></script>
<script th:src="@{/assets/plugins/layui/layui.js}"></script>
<script th:src="@{/assets/js/common.js}"></script>
<script th:src="@{/assets/js/baseutil.js}"></script>
<script th:src="@{/assets/js/ui.js?v=3.1.0}"></script>
<script th:inline="javascript"> var ctx = [[@{/}]]; </script>

<script th:src="@{/assets/js/ckobject.js}"></script>
    <script>
    var id=[[${id}]];
    var first=[[${first}]];
    var prefix = ctx + "exam/exarrange";
    var tm_maxtime = 0;
    var tm_maxtime0 = [[${paper.duration}]]*60;
	var tm_timer = null;
    var tm_page_confirm=false;
    var tm_pid = "";
	var tm_uid = "";
	var heartbeatrate=60000;
	var hb_timer=null;
	var examtoken="";
	var nojj=[[${paper.nojj}]];
	var ofile="[[${ofile}]]";
    $(function(){ 
    	bver=(CKobject.Platform()+' '+CKobject.browser()['B']+' v'+CKobject.browser()['V']);
    	if(bver.indexOf("IE v") >0) {
    		$("#bver").show(); 
    		$("#mynav").hide();
    		$("#mydata").hide();
    	}	else{
    		$("#bver").hide();
    		$("#mynav").show();
    		$("#mydata").show();
    		getLeftTime();
    		
    		//forceFull("进入考试窗口");
    	};
		tm_pid=$("#id").val();
		tm_uid=$("#uid").val();

    	if (typeof dnO !== 'undefined')
			dnO(ofile,first,$("#ksid").val(),tm_uid);
    	if (typeof IsJoinExam !== 'undefined')
    		IsJoinExam();
    	$(".tm_paper_section input[type='checkbox'], input[type='radio']").iCheck({
            cursor: true,
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
            increaseArea: '20%'
        });
    	$(".tm_paper_section h1").click(function(){
			$(this).parent().children(".tm_paper_question").toggle();
		});
		examtoken="C" + tm_uid + tm_pid;
		initPaper();
		$("#endks").click(function(){submitPaper();});
		if(heartbeatrate > 0){
			hb_timer=window.setInterval(function(){
				var scache = tmUserDataCache.getCache();
				//if(!baseutil.isNull(scache)){
					ajaxSaveCache(examtoken, scache);//远存
				//}
			}, heartbeatrate);
		};
		if (first == 1) tmUserDataCache.removeCache();
		if($("#leftnav").width()+$("#rightnav").width()>$("#mynav").width()) $(".maybehide").hide();
    })
window.onresize = function(){
	if(!checkFull()){
		//$("#content-main").html("退出全屏");
		//$("#wrapper").hide();
		//forceFull("不要退出考试窗口");
	}
	else {
		//$("#wrapper").show();
		
	}
}

    function initPaper(){
    	bindQuickTip();
		tmLoadUserPaperCache();
    }
    function bindQuickTip(){
    	$("input.qk-choice").on('ifChecked', function(event){
			var thename = $(this).attr("name");
			var thetype=$(this).attr("type")
			var theqid = thename.substring(2);//.replace("Q-","")
			var chval = $.form.getCheckedValue({"type":thetype,"name":thename,"flag":0});
			tmUserDataCache.addCache(theqid, "choice", chval);
			if(baseutil.isNull(chval)){
				$("#fast_"+theqid).prop("class","");
			}else{
				$("#fast_"+theqid).prop("class","finished");
			}

		});
    }
    function bindQuickTip2(theqid,chval){
			tmUserDataCache.addCache(theqid, "op", chval);
			if(chval==0){
				$("#fast_"+theqid).prop("class","");
			}else{
				$("#fast_"+theqid).prop("class","finished");
			}
    }
	var tmUserDataCache = {
		removeCache: function(){
			lrwstorage.clear();	
		},
		support : function(){
			return lrwstorage.support();
		},
		addCache : function( qid, qtype, val){
			if(!tmUserDataCache.support()){
				return;
			}
			var cacheData = tmUserDataCache.getCache();
			var cacheJson = [];

			try{
				if(!baseutil.isNull(cacheData)){
					cacheJson = JSON.parse(cacheData);
				}

				$(cacheJson).each(function(idx, item){
					var _name = "Q-" + qid;
					if(_name == item["name"]){
						cacheJson.splice(idx, 1);//删除数组中idx位置的1个元素
					}
				});
				cacheJson.push({"name" : "Q-" + qid, "type" : qtype, "value" : val});
				
				var strCacheData = JSON.stringify(cacheJson);
				lrwstorage.set(examtoken, strCacheData);

			}catch(e){
				//BROWSER DOESN'T SUPPORTED
			}

		},

		getCache : function(){
			if(!tmUserDataCache.support()){
				return;
			}
			return lrwstorage.get(examtoken);
		}
	};
	/**** 远程保存答卷Cache ****/
	function ajaxSaveCache(token, cachedata){
		if(baseutil.isNull(cachedata)){
			console.log("无答卷数据，不同步");
			return;
		}
		$.ajax({
			type: "POST",
			url: prefix+"/saveHeartB",
			data: {"id":id,"token":null, "cdata":null},//"token":token, "cdata":cachedata
			dataType: "json",
			success: function(ret){
				if(ret.code == 0){
				}else{
					$.modal.alertWarning("服务器通信发生异常，请检查网络或联系管理员"); return;
				}
			},
			error:function(){
				$.modal.alertError("服务器通信发生异常，请检查您的网络"); return;
			}
		}); 
	}
	
	//加载本地缓存
	function tmLoadUserPaperCache(){
		var cacheData = tmUserDataCache.getCache();
		if(baseutil.isNull(cacheData)){//换机器考试，应该从服务器cache取缓存
			//ajaxLoadCache(examtoken);
			return;
		}
		loadCache(cacheData);		
	}
	//加载远程缓存
	function ajaxLoadCache(token){
		$.ajax({
			type: "POST",
			url: prefix+"/loadCache",
			data: {"token":token},
			dataType: "json",
			success: function(ret){
				if(ret.code == 0){
					try{
						//var scachedata = JSON.stringify(ret.cdata);
						var scachedata=ret.msg;
						if(baseutil.isNull(scachedata)) return;
						loadCache(scachedata);
						if(tmUserDataCache.support()){
							lrwstorage.set(token, scachedata);
						}
					}catch(e){
						$.modal.alertWarning("浏览器不支持，请使用Chrome、Firefox、360极速浏览器。\r\n"+e);
					}
				}
			},
			error:function(){
				$.modal.alertError("服务器通信发生异常，请检查您的网络");
			}
		});
	}
	function loadCache(cacheData){
		try{
			var cacheJson = JSON.parse(cacheData);
			$.each(cacheJson, function(idx, item){

				if(item["type"]=="blank"){
					$("input[name='"+item["name"]+"']").each(function(ii, iblank){
						$(this).val(item["value"][ii]);
					});

				}else if(item["type"]=="choice"){
					//未选中，是无值的。对应赋值后，有值即为选中
					//$("input[name='"+item["name"]+"']").val(item["value"].split(""));
					$("input[name='"+item["name"]+"']").each(function(ii, ichoice){
						if(item["value"].indexOf($(this).val())>=0)
							$(this).iCheck('check');
					});
				}else if(item["type"]=="essay"){
					$("textarea[name='"+item["name"]+"']").val(item["value"]);
				}
				
				try{
					var theqid = item["name"].replace("Q-","");
					$("#fast_"+theqid).prop("class","finished");
				}catch(e){}
				
			});
			
		}catch(e){
			//BROWSER DOESN'T SUPPORTED
		}
	}
	function submitPaper(){
		if((tm_maxtime0-tm_maxtime)/60<nojj){
			$.modal.alertWarning("开考【 "+nojj+"】分钟内不允许交卷");
			return;
		}
		$('#endks').toggleClass("disabled");
		$('#endks').prop('disabled', true); //禁用
		
		var cacheData = tmUserDataCache.getCache();
		if(baseutil.isNull(cacheData)){
			$.modal.alertWarning("交卷时没有发现你做的答案，请联系监考老师");
			return;	
		}
		var cacheJson =[];
		try{
			cacheJson = JSON.parse(cacheData);
		}catch(e){
			$.modal.alertWarning("交卷时遇到数据格式错误，请联系监考老师");
			return;
		}
		var didtinum=cacheJson.length;
		var tinum=[[${paper.total}]];
		var tipstr="";
		if(didtinum<tinum) tipstr="<b style='font-size:18px;'>你还有<span style='color:red;'>"+(tinum-didtinum)+"</span>题未完成。确定要继续交卷吗？</b>";
		else tipstr="<b style='font-size:18px;'>当您确定交卷后<span style='color:red;'>不可以再答题</span>。确定交卷吗？</b>";
		$.modal.confirm3(tipstr,function(){
			if(tm_timer)clearInterval(tm_timer);
			window.onbeforeunload = null;
			tm_page_confirm = true;
			var cacheJson2=[];
			$(cacheJson).each(function(idx, item){
				var _name = item["name"];
				var qid=_name.substring(2);//"qscore" : $("#sc"+_name).text(),
				cacheJson2.push({"id" : qid,  "qans" : item["value"]});
			});
			
			var config = {
        	        url: prefix+"/saveScores",
        	        type: "post",
        	        dataType: "json",
        	        data: {"data":JSON.stringify(cacheJson2),"id":id,"token":examtoken},
        	        beforeSend: function () {
        	        	$.modal.loading("正在处理中，请稍后...");
        	        },
        	        success: function(result) {
        	        	if (result.code == 0) {
        	        		tmUserDataCache.removeCache();
        	        		if(hb_timer)clearInterval(hb_timer);
        	        		if (typeof upksfile !== 'undefined')
        	        			upksfile();
        	        		//layer.msg(result.msg,function(){window.location.href=ctx+"login/kdlogout";});
                        } else {
                        	$.modal.alertError(result.msg);
                        	$('#endks').toggleClass("disabled");
            				$('#endks').prop('disabled', false);
            				$.modal.closeLoading();
                        }
                    	//$.modal.closeLoading();
        	        }
        	    };
        	    $.ajax(config);
			},function(){
				$('#endks').toggleClass("disabled");
				$('#endks').prop('disabled', false);
			});
		
	};
	function submitPaper2(){
		$('#endks').toggleClass("disabled");
		$('#endks').prop('disabled', true); //禁用
		
		var cacheData = tmUserDataCache.getCache();
		if(baseutil.isNull(cacheData)){
			$.modal.alertWarning("交卷时没有发现你做的答案，请联系监考老师");
			return;	
		}
		var cacheJson =[];
		try{
			cacheJson = JSON.parse(cacheData);
		}catch(e){
			$.modal.alertWarning("交卷时遇到数据格式错误，请联系监考老师");
			return;
		}
		var didtinum=cacheJson.length;
		var tinum=[[${paper.total}]];
			if(tm_timer)clearInterval(tm_timer);
			window.onbeforeunload = null;
			tm_page_confirm = true;
			var cacheJson2=[];
			$(cacheJson).each(function(idx, item){
				var _name = item["name"];
				var qid=_name.substring(2);//"qscore" : $("#sc"+_name).text(),
				cacheJson2.push({"id" : qid,  "qans" : item["value"]});
			});
			
			var config = {
        	        url: prefix+"/saveScores",
        	        type: "post",
        	        dataType: "json",
        	        data: {"data":JSON.stringify(cacheJson2),"id":id,"token":examtoken},
        	        beforeSend: function () {
        	        	$.modal.loading("正在处理中，请稍后...");
        	        },
        	        success: function(result) {
        	        	if (result.code == 0) {
        	        		tmUserDataCache.removeCache();
        	        		if(hb_timer)clearInterval(hb_timer);
        	        		if (typeof upksfile !== 'undefined')
        	        			upksfile();
        	        		//layer.msg(result.msg,function(){window.location.href=ctx+"login/logout";});                        	
                        } else {
                        	$.modal.alertError(result.msg);
                        	$('#endks').toggleClass("disabled");
            				$('#endks').prop('disabled', false);
            				$.modal.closeLoading();
                        }
                    	//$.modal.closeLoading();
        	        }
        	    };
        	    $.ajax(config);
	};
	function upfileend(a){
		if(a==1){
			$.modal.closeLoading();
			layer.msg("交卷成功！",function(){window.location.href=ctx+"login/kdlogout";});
		}else $.modal.closeLoading();
	}
    function moveToQuestion(qid){
		var thetop = $("#quick-Q-" + qid).offset().top-50;
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: thetop}, 500);
	}
    function tm_fn_formatSeconds(time){
    	hour = Math.floor(time / (60*60)) ;
		minute = Math.floor(time/60) - (hour * 60);
		second = Math.floor(time) -(hour * 60 * 60) - (minute * 60);
		(hour <= 9)?((hour == 0)?$("#h4").parent().hide():$("#h4").text('0' + hour)):$("#h4").text(hour);
		(minute <= 9)?((hour == 0 && minute == 0)?$("#i4").parent().hide():$("#i4").text('0' + minute)):$("#i4").text(minute);
		(second <= 9)?$("#s4").text('0' + second):$("#s4").text(second);
    }
    function countDown(){
    	tm_fn_formatSeconds(tm_maxtime);
		var tm_msg;
		if(tm_maxtime>0){
			if(tm_maxtime <= 30){
				$("#div_processor_timer").html("<font color='red'><b>考试时间不足30秒钟，请交卷！</b></font>");
			}else if(tm_maxtime == 5*60) {
				$.modal.alertWarning("考试还剩余5分钟<br /><span style='color:red'>请在考试结束前交卷！</span>");   
			}
			--tm_maxtime;
		}else{
			tm_page_confirm = true;
			clearInterval(tm_timer);  
			$("#s4").parent().hide();
			$("#div_processor_timer").html("<font color='red'><b>考试时间到，即将自动交卷！</b></font>");
			submitPaper2();//自动交卷
		}
	}
    function getLeftTime(){
    	var config = {
    	        url: prefix+"/getLeftTime/"+id,
    	        type: "post",
    	        dataType: "json",
    	        data: {},
    	        success: function(result) {
    	        	tm_maxtime = parseInt(result.msg)*60;
    	        	if(tm_maxtime<=0){
    	        		//$.modal.alertError("考试已结束");
    	        		layer.msg("考试已结束",function(){window.location.href=ctx+"login/kdlogout";});
    	        		return;
    	        	}
    	        	tm_timer = setInterval("countDown()",1000); 
    	        }
    	    };
    	    $.ajax(config)
    }
    function tmPaperFont(i){
		$("#tm_font_1").removeClass("tm_font_on");
		$("#tm_font_2").removeClass("tm_font_on");
		$("#tm_font_3").removeClass("tm_font_on");
		$("#tm_font_"+i).addClass("tm_font_on");

		var v_font_size = "12px";
		var v_line_height = "20px";
		if(i==2){
			v_font_size = "18px";
			v_line_height = "30px";
		}else if(i ==3){
			v_font_size = "24px";
			v_line_height = "35px";
		}
		
		$(".tm_paper_question thead tr td").css({"font-size":v_font_size, "line-height":v_line_height});
		$(".tm_paper_question thead tr td *").css({"font-size":v_font_size, "line-height":v_line_height});
		$(".tm_paper_question tbody tr td *").css({"font-size":v_font_size, "line-height":v_line_height});
	}
    function checkFull(){
    	var isFull =  document.webkitIsFullScreen;
    	if(isFull === undefined) isFull = false;
    	return isFull;
    }
    function forceFull(c){
    	layer.confirm(c, {
	        icon: 3,
	        title: "系统提示",
	        btn: ['确认'],
			btnclass: ['btn btn-primary']
	    }, function (index) {
	    	layer.close(index);
	    	$('#wrapper').fullScreen();	    	
	    });
    }

    function tm_checkUnsubmit(){//return tm_checkUnsubmit();
    	if(tm_page_confirm == false){ 
    		return '考试还没有完成，你确定要离开考试吗？';
    	}
    }    

	document.oncontextmenu= function(){return false;}
    </script>
<style>
#backtotop {
     width: 24px;
     color: white;
     padding: 12px 0px 12px 5px;
     display: none;
     position: fixed;
     cursor: pointer;
     text-align: center;
     z-index: 20;
     background-color: rgba(0, 188, 212, 0.65);
     border-radius: 12px 0px 0px 12px;
}
</style>
<div id="backtotop" style="right: 0px;display: none;">回到顶部</div>
<script>
var $backtotop = $('#backtotop');
var toplrw = $(window).height() -$backtotop.height() - 20;
function moveBacktotop() {
     if(toplrw<0)toplrw=0;
     $backtotop.css({ top: toplrw,right: 0});
}
$backtotop.click(function () {
     $('html,body').animate({ scrollTop:0 });
     return false;
});

$(window).scroll(function () {
     var windowHeight = $(window).scrollTop();
     if(windowHeight > 200) {
     $backtotop.fadeIn();
     } else{
     $backtotop.fadeOut();
     }
});
moveBacktotop();
$(window).resize(moveBacktotop);

</script>    
</body>
</html>
